﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFExcelReport.Controls">

    <local:RulerBlockSizeConverter x:Key="RulerBlockSizeConverter" />
    
    <DataTemplate DataType="{x:Type local:RulerBlockItem}">
        <Border BorderBrush="Black" BorderThickness="1,1,0,0">
            <Border.Width>
                <MultiBinding Converter="{StaticResource RulerBlockSizeConverter}">
                    
                    <Binding Path="TickTimeSpan">
                        <Binding.RelativeSource>
                            <RelativeSource AncestorType="{x:Type local:TimelineRulerControl}" />
                        </Binding.RelativeSource>
                    </Binding>
                    
                    <Binding Path="Span" />
                    
                </MultiBinding>
            </Border.Width>
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFFFF8DC" Offset="0"/>
                    <GradientStop Color="#FFB0C4DE" Offset="0.812"/>
                    <GradientStop Color="#FFA9A9A9" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Viewbox Margin="3">
                <TextBlock Text="{Binding Text}" />
            </Viewbox>
        </Border>
    </DataTemplate>
    
    <Style TargetType="{x:Type local:TimelineRulerControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TimelineRulerControl}">
                    <ItemsControl
                        ItemsSource="{TemplateBinding RulerBlocks}">
                        
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel Orientation="Horizontal" />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>